{?set jieqi_blocks_module = "article"?}
{?set jieqi_blocks_config = "authorblocks"?}
<script type="text/javascript">
function frmnewchapter_validate(){
  if(document.frmnewchapter.chaptername.value == ""){
    alert("请输入章节标题");
    document.frmnewchapter.chaptername.focus();
    return false;
  }
}
//统计输入字数
function show_inputwords(txt){
	txt = $_(txt);
	var words = (arguments.length > 1) ? $_(arguments[1]) : $_(txt.id + '_words');
	words.innerHTML = txt.value.replace(/[\x00-\x08\x0e-\x1f\x21-\xff]+/gi, 'w').replace(/\s/g, '').length;
}
//显示默认字数
addEvent(window, 'load', function(){show_inputwords('chaptercontent');});
//临时保存章节内容
function chapter_autosave(){
	if($_('chaptercontent').value != '') Ajax.Request('{?$jieqi_url?}/autosave.php',{method :'POST',parameters:'savedata='+encodeURIComponent($_('chaptercontent').value)});
}
AutoSaveTimer = setInterval(chapter_autosave, 60000);
</script>
<script type="text/javascript" src="{?$jieqi_url?}/scripts/attaches.js"></script>
<form name="frmnewchapter" id="frmnewchapter" action="{?$url_newchapter?}" method="post" onsubmit="return frmnewchapter_validate();" enctype="multipart/form-data">
<table width="100%" class="grid" cellspacing="1" align="center">
<caption>增加章节</caption>
<tr valign="middle" align="left">
  <td class="tdl" width="20%">小说名称：</td>
  <td class="tdr"><a href="{?$article_static_url?}/articlemanage.php?id={?$articleid?}">{?$articlename?}</a></td>
</tr>
<tr valign="middle" align="left">
  <td class="tdl">分卷名称：</td>
  <td class="tdr">
  <select class="select"  size="1" name="chapterorder" id="chapterorder">
  {?section name=i loop=$volumerows?}
  <option value="{?$volumerows[i].chapterorder?}"{?if $volumerows[i].chapterorder == $chapterorder?} selected="selected"{?/if?}>{?$volumerows[i].volumename?}</option>
  {?/section?}
  </select>
  </td>
</tr>
<tr valign="middle" align="left">
  <td class="tdl">章节标题：</td>
  <td class="tdr"><input type="text" class="text" name="chaptername" id="chaptername" size="50" maxlength="50" value="{?$chaptername?}" /></td>
</tr>
<tr valign="middle" align="left">
  <td class="tdl">章节内容：<br />已输入 <span class="hot" id="chaptercontent_words">0</span> 字</td>
  <td class="tdr"><textarea class="textarea" name="chaptercontent" id="chaptercontent" rows="25" cols="80" onkeyup="show_inputwords(this);" oninput="show_inputwords(this);" onpropertychange="show_inputwords(this);">{?if $chaptercontent == ''?}{?$jieqi_autosave?}{?else?}{?$chaptercontent?}{?/if?}</textarea></td>
</tr>
{?if $attachnum > 0?}
<tr valign="middle" align="left">
  <td class="tdl">现有附件： <br /><span class="hot">（取消打勾表示删除该附件）</span></td>
  <td class="tdr">
    {?section name=i loop=$attachrows?}
    <label class="checkbox"><input type="checkbox" name="oldattach[]" value="{?$attachrows[i].attachid?}" checked="checked" />{?$attachrows[i].name?}</label>
    {?/section?}
  </td>
</tr>
{?/if?}
{?if $canupload == true && $maxattachnum > 0?}
<tr valign="middle" align="left">
  <td class="tdl">附件限制：</td>
  <td class="tdr">文件类型：{?$attachtype?}, 图片最大：{?$maximagesize?}K, 文件最大：{?$maxfilesize?}K</td>
</tr>
<tr valign="middle" align="left">
  <td class="tdl">附件上传：</td>
  <td class="tdr">
  <input type="file" class="file" name="attachfile[]" id="attachfile" onchange="Attaches.addFile('attachfile', 'attachdiv', true);" /><button type="button" class="filebutton" onclick="if(document.all){document.getElementById('attachfile').outerHTML += '';}else{document.getElementById('attachfile').value = '';}">清空</button>
  <div id="attachdiv"></div>
  </td>
</tr>
{?/if?}
{?if $issign >= 10?}
<tr valign="middle" align="left">
  <td class="tdl">是否免费：</td>
  <td class="tdr">
  <label class="radio"><input type="radio" name="isvip" value="0"{?if $cvip == 0?} checked="checked"{?/if?} />免费章节</label>&nbsp;
  <label class="radio"><input type="radio" name="isvip" value="1"{?if $cvip > 0?} checked="checked"{?/if?} />VIP章节</label>&nbsp;{?if $customprice > 0?}<input type="text" class="text" name="saleprice" id="saleprice" size="4" maxlength="10" value="{?$saleprice?}" />{?$egoldname?} <span class="hot">(留空则自动按字数计价)</span>{?/if?}
</td>
</tr>
{?/if?}
<tr valign="middle" align="left">
  <td class="tdl">是否完本：</td>
  <td class="tdr">
  <label class="radio"><input type="radio" name="fullflag" value="0" checked="checked" />未完待续</label>&nbsp;
  <label class="radio"><input type="radio" name="fullflag" value="1" />完结篇</label>
</td>
</tr>
{?if $authtypeset == 1?}
<tr valign="middle" align="left">
  <td class="tdl">小说排版：</td>
  <td class="tdr">
  <label class="radio"><input type="radio" name="typeset" value="1" checked="checked" />自动排版</label>&nbsp;
  <label class="radio"><input type="radio" name="typeset" value="0" />无需排版</label>
</td>
</tr>
{?/if?}
<tr valign="middle" align="left">
  <td class="tdl">发表方式：</td>
  <td class="tdr">
  <label class="radio"><input type="radio" name="posttype" value="0" checked="checked" />直接发表</label>&nbsp;
  <label class="radio"><input type="radio" name="posttype" value="1" />存为草稿</label>&nbsp;
  {?if $uptiming > 0?}
  <label class="radio"><input type="radio" name="posttype" value="2" />定时发表</label>
  <input type="text" class="text" style="width:3em;" name="pubyear" id="pubyear" maxlength="4" value="{?$jieqi_time|date:'Y'?}" />年<input type="text" class="text" style="width:2em;" name="pubmonth" id="pubmonth" maxlength="2" value="{?$jieqi_time|date:'m'?}" />月<input type="text" class="text" style="width:2em;" name="pubday" id="pubday" maxlength="2" value="{?$jieqi_time|date:'d'?}" />日<input type="text" class="text" style="width:2em;" name="pubhour" id="pubhour" maxlength="2" value="" />时<input type="text" style="width:2em;" class="text" name="pubminute" id="pubminute" maxlength="2" value="" />分
  {?/if?}
  </td>
</tr>
{?if $needupaudit > 0?}
<tr valign="middle" align="left">
  <td class="tdl">注意：</td>
  <td class="tdr">
  <span class="hot">直接发表的章节也会先保存在草稿箱待审章节列表中，管理员审核后才能正常显示。</span>
  </td>
</tr>
{?/if?}
<tr valign="middle" align="left">
  <td class="tdl">
  &nbsp;
  <input type="hidden" name="act" value="newchapter" />{?$jieqi_token_input?}
  <input type="hidden" name="aid" value="{?$articleid?}" />
  {?if $draftid > 0?}<input type="hidden" name="draftid" value="{?$draftid?}" />{?/if?}
  </td>
  <td class="tdr">
  <button type="submit" class="button" name="submit"> 提 交 </button>
  </td>
</tr>
</table>
</form>